-----------------------------------
-- Area: Xarcabard
-- NPC:  Shadow Eye
-- Custom Biast Fight
-----------------------------------

require("scripts/globals/status");

-----------------------------------
-- onMobInitialize Action
-----------------------------------

function onMobInitialize(mob)
	mob:addStatusEffect(EFFECT_REFRESH,100,3,0);
	printf("Shadow Eye Initialized");
end;

-----------------------------------
-- onMobEngaged
-----------------------------------

function onMobEngaged(mob,target)

	mob:delStatusEffect(EFFECT_REGAIN);
	mob:delStatusEffect(EFFECT_MANAFONT);
	mob:delStatusEffect(EFFECT_MIGHTY_STRIKES);
	mob:delStatusEffect(EFFECT_CHAINSPELL);
	
end;

-----------------------------------
-- onMobFight
-----------------------------------

function onMobFight(mob,target)

	-- Set phase
	if((mob:getHP() <= 12500) and (GetServerVariable("Shadow_Eye_Phase") < 4)) then
		SetServerVariable("Shadow_Eye_Phase",4);
		printf("Shadow Eye Phase 4");
		mob:addStatusEffect(EFFECT_REGAIN, 100, 1, 30, 0);
	elseif((mob:getHP() <= 25000) and (GetServerVariable("Shadow_Eye_Phase") < 3)) then
		SetServerVariable("Shadow_Eye_Phase",3);
		printf("Shadow Eye Phase 3");
		mob:addStatusEffect(EFFECT_CHAINSPELL, 0, 1, 30, 0);
	elseif((mob:getHP() <= 37500) and (GetServerVariable("Shadow_Eye_Phase") < 2)) then
		SetServerVariable("Shadow_Eye_Phase",2);
		printf("Shadow Eye Phase 2");
		mob:addStatusEffect(EFFECT_MIGHTY_STRIKES, 0, 1, 30, 0);
	elseif(GetServerVariable("Shadow_Eye_Phase") < 1) then
		SetServerVariable("Shadow_Eye_Phase",1);
		printf("Shadow Eye Phase 1");
		mob:addStatusEffect(EFFECT_MANAFONT, 0, 1, 30, 0);
	end
	GetMobByID(17235988):updateEnmity(target);
	printf("Biast enmity update");

end;

-----------------------------------
-- onMobDeath
-----------------------------------

function onMobDeath(mob,killer)
	
end;

-----------------------------------
-- onEventUpdate
-----------------------------------

function onEventUpdate(player,csid,option)
--printf("updateCSID: %u",csid);
--printf("RESULT: %u",option);
end;

-----------------------------------
-- onEventFinish
-----------------------------------

function onEventFinish(player,csid,option)
--printf("finishCSID: %u",csid);
--printf("RESULT: %u",option);
end;